package com.zhongge.arrayqueue;

/**
 * @ClassName Test
 * @Description TODO
 * @Author 笨忠
 * @Date 2025/8/26 10:14
 * @Version 1.0
 */
public class Test {
    public static void main(String[] args) {
        MyCircularQueue queue = new MyCircularQueue(10);

        //入队
        System.out.println("=========入队==========");
        System.out.println(queue.enQueue(10));
        System.out.println(queue.enQueue(20));
        System.out.println(queue.enQueue(30));
        System.out.println();

        System.out.println("========出队===========");
        //出队
        try {
            System.out.println(queue.deQueue());
            System.out.println(queue.deQueue());
            System.out.println(queue.deQueue());
        } catch (ElemEmptyException e) {
            e.printStackTrace();
        }
        System.out.println();


        //获取对头元素
        System.out.println("========获取对头元素=====");
        try {
            System.out.println(queue.Front());
        } catch (ElemEmptyException e) {
            e.printStackTrace();
        }
        System.out.println();

        //获取对尾元素
        System.out.println("========获取对尾元素===");
        try {
            System.out.println(queue.Rear());
        } catch (ElemEmptyException e) {
            e.printStackTrace();
        }
        //判空
        System.out.println(queue.isEmpty());
    }
}
